<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查找字符串中特定的字符若找到则返回该字符-match()方法</title>
</head>

<body>
    <script>
        var str = "Hello world!";
        document.write(str.match("world") + "<br>");
        document.write(str.match("World") + "<br>");
        document.write(str.match("worlld") + "<br>");
        document.write(str.match("world!"));
    </script>
</body>

</html>